This page last changed on Nov 16, 2005 by rossmason.

You can bridge different Jms implementations even if they are based on different versions of the Jms specification. To do so you need to define two Jms connectors, one for each Jms server and then configure your inbound endpoint to use one Jms connector and the outbound endpoint to use the other one. In the following example we bridge from OpenJms to ActiveMQ. OpenJms is based on the Jms 1.0.2b specification, ActiveMQ on the Jms 1.1 specification.

<mule-configuration id="jmsBridge" version="1.0">

    <!-- OpenJMS configuration -->
    <connector name="openJmsConnector" className="org.mule.providers.jms.JmsConnector">
        <properties>
            <property name="connectionFactoryJndiName" value="JmsQueueConnectionFactory"/>
            <property name="jndiInitialFactory" value="org.exolab.jms.jndi.InitialContextFactory"/>
            <property name="jndiProviderUrl" value="tcp://localhost:3035"/>
            <property name="specification" value="1.0.2b"/>
        </properties>
    </connector>
    
    <!-- ActiveMQ configuration -->
    <connector name="activeMQConnector" className="org.mule.providers.jms.JmsConnector">
        <properties>
            <property name="connectionFactoryJndiName" value="ConnectionFactory"/>
            <property name="jndiInitialFactory" value="org.activemq.jndi.ActiveMQInitialContextFactory"/>
            <property name="specification" value="1.1"/>
	        <map name="connectionFactoryProperties">
		    <property name="brokerURL" value="tcp://localhost:61616"/>
		</map>
        </properties>
    </connector>
    ....
</mule-configuration>

Next we configure two endpoints, inbound and outbound, that use these connectors.

<global-endpoints>
    <endpoint name="openJmsInbound" address="jms://test.in" connector="openJmsConnector"/>
    <endpoint name="activeMQOutbound" address="jms://test.out" connector="activeMQConnector"/>
</global-endpoints>

Finally, we need to configure a Bridge component that will receive on the openJmsInbound endpoint and send the event directly out on the activeMQOutbound endpoint.

<mule-descriptor name="jmsBridgeComponent" 
                 implementation="org.mule.components.simple.BridgeComponent">
    <inbound-router>
        <global-endpoint name="openJmsInbound"/>
    </inbound-router>
    <outbound-router>
        <router className="org.mule.routing.outbound.OutboundPassThroughRouter">
            <global-endpoint name="activeMQOutbound"/>
        </router>
    </outbound-router>
</mule-descriptor>
Document generated by Confluence on Nov 27, 2006 10:27